package com.dy.dao;

import com.dy.bean.SugarBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SugarDao {
    @Select("SELECT b2.`name`,sum(final_total_amount)'value' FROM order_info o \n" +
            "LEFT JOIN order_detail d on o.id=d.order_id\n" +
            "LEFT JOIN sku_info s on d.sku_id = s.id\n" +
            "LEFT JOIN base_category3 b3 on s.category3_id=b3.id\n" +
            "LEFT JOIN base_category2 b2 on b3.category2_id = b2.id\n" +
            "GROUP BY b2.`name`")
    List<SugarBean> showMaxTwo();
    @Select("SELECT b.`name`,sum(final_total_amount)'value' FROM order_info o \n" +
            "LEFT JOIN order_detail d on o.id=d.order_id\n" +
            "LEFT JOIN sku_info s on d.sku_id = s.id\n" +
            "LEFT JOIN base_trademark b on s.tm_id=b.id\n" +
            "GROUP BY b.`name`")
    List<SugarBean> showPp();
    @Select("SELECT b.name,sum(final_total_amount)'value' FROM order_info o \n" +
            "LEFT JOIN base_province b on o.province_id = b.id\n" +
            "GROUP BY b.name")
    List<SugarBean> showMap();
    @Select("call sp4")
    Double showSum();
    @Select("SELECT sp.spu_name name,sum(final_total_amount)'value' FROM order_info o \n" +
            "LEFT JOIN order_detail d on o.id=d.order_id\n" +
            "LEFT JOIN sku_info s on d.sku_id = s.id\n" +
            "LEFT JOIN spu_info sp on s.spu_id = sp.id\n" +
            "GROUP BY sp.spu_name")
    List<SugarBean> showSpu();
}
